package com.cf.log;


import com.cf.log.core.LogAspect;
import com.cf.log.core.LogPersistenceService;
import com.cf.log.core.LogPersistenceServiceImpl;
import lombok.extern.slf4j.Slf4j;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * game-server-LogConfig
 *
 * @author <a href="2428922347@qq.com">Zhu mingming</a>
 * @info
 * @since 2018/5/16 下午 02:15
 */
@Slf4j
@Configuration
@ConditionalOnMissingBean(LogAspect.class)
public class AutoLogConfig {


    @Bean
    @ConditionalOnMissingBean(value = LogPersistenceService.class)
    public LogPersistenceServiceImpl logPersistenceService() {
        log.info("缺失LogPersistenceService，创建默认的LogPersistenceService");
        return new LogPersistenceServiceImpl();
    }


    @Bean
    @ConditionalOnMissingBean(value = LogAspect.class)
    public LogAspect logAspect() {
        log.info("创建日志切面LogAspect");
        return new LogAspect();
    }

}
